<template>
  <div id="left-choose">
    <div class="title">
      <span>题型选择</span>
    </div>
    <el-tree :data="data"  @node-click="handleNodeClick" :default-expand-all="true"></el-tree>
  </div>
</template>

<script>
export default {
  name:'LeftChoose',
  data() {
    return {
      data: [{
        label: '选择题',
        children: [{
          label: '单项选择',
        },
          {
            label: '多项选择',
          }]
      }, {
        label: '填空题',
        children: [{
          label: '填空',
        },]
      }, {
        label: '评分题',
        children: [{
          label: '评分',
        }]
      },
        {
          label: '获取地理位置信息'
        }],
    };
  },
  emits: ['addQuestion'],
  methods: {
    handleNodeClick(data) {
      if(data.children == null) {
        this.$emit('addQuestion', data.label)
      }
    }
  }
}
</script>

<style scoped src='assets/css/editcss/leftChoose.css'>
  /* @import url('./css/leftChoose.css'); */
</style>
